#include "dialogAdvanceConfig.h"

DialogAdvanceConfig::DialogAdvanceConfig(QWidget *parent) :QDialog(parent){
    this->setWindowTitle("高级配置");
#ifdef Q_OS_ANDROID
    this->setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
#else
    this->setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint ^ Qt::WindowStaysOnTopHint);
    this->setModal(false);
#endif

#ifdef Q_OS_ANDROID
    this->setParent(parent);
    this->setWindowFlags(Qt:: Dialog | Qt:: FramelessWindowHint);
    this->setStyleSheet("QDialog{background-color: white; padding:20px; border: none; border: 10px solid rgb(200,219,243);}");
#else
    this->setStyleSheet("QDialog{background-color: white;}");
#endif

    _layout = new QVBoxLayout(this);
    this->setLayout(_layout);
//    this->setStyleSheet("background: #FFFFFF");
    this->setMinimumSize(QSize(940, 600));
    this->setMaximumSize(QSize(940, 600));
//    this->setFixedWidth(1040);
//    this->setFixedHeight(600);
//    _qmlAAC = new QMLAdvancedAnalysisConfig();
//    _layout->addWidget(_qmlAAC);
    _ac = new AdvancedConfig(8, 12, this);
    _layout->addWidget(_ac);
    connect(_ac, SIGNAL(sigCancel()), this, SLOT(close()));
}


void DialogAdvanceConfig::showEvent(QShowEvent *e){

    QDialog::showEvent(e);
#ifdef Q_OS_ANDROID
//    if(this->parent() != nullptr)
//        this->setGeometry(((QWidget*)parent())->width()/2-200, ((QWidget*)parent())->height()/2-this->height()/2, 400, 500);
#endif

}

//QMLAdvancedAnalysisConfig* DialogAdvanceConfig::component(){
//    return _qmlAAC;
//}

AdvancedConfig* DialogAdvanceConfig::component(){
    return _ac;
}

DialogAdvanceConfig::~DialogAdvanceConfig(){
    if(_qmlAAC){
        delete _qmlAAC;
    }
}
